import Vue from 'vue'
import Router from 'vue-router'
import index from '@/components/index'
import catPage from '@/components/catPage'
import searchPage from '@/components/searchPage'
import searchResPage from '@/components/searchResPage'
import itemDetail from '@/components/itemDetail'
import jpItemDetail from '@/components/jpItemDetail'
import jpItemsPage from '@/components/jpItemsPage'
import jhsItemsPage from '@/components/jhsItemsPage'
import jhsItemDetail from '@/components/jhsItemDetail'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      component: index
    },
    {
    	path: '/cat-page',
    	component: catPage,
    },
    {
      path: '/search-page',
      component: searchPage
    },
    {
      path: '/search-res',
      component: searchResPage
    },
    {
      path: '/item-detail',
      component: itemDetail
    },
    {
      path: '/jp-items',
      component: jpItemsPage
    },
    {
      path: '/jpitem-detail',
      component: jpItemDetail
    },
    {
      path: '/jhs-items',
      component: jhsItemsPage
    },
    {
      path: '/jhsitem-detail',
      component: jhsItemDetail
    },
  ],

  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return {x: 0, y: 0}
    }
  }
})
